package lv.accenture.ex06;

import java.util.Iterator;
import java.util.List;

public class Bookmark {
	
	private String url;
	private String title;
	private String description;
	
	private String uid;

	private String creator;
	private String year;
	private List<String> tags;
	
	
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getCreator() {
		return creator;
	}
	public void setCreator(String creator) {
		this.creator = creator;
	}
	public String getYear() {
		return year;
	}
	public void setYear(String year) {
		this.year = year;
	}
	public List<String> getTags() {
		return tags;
	}
	public void setTags(List<String> tags) {
		this.tags = tags;
	}
	public String getUid() {
		return uid;
	}
	public void setUid(String uid) {
		this.uid = uid;
	}
	public String toString()
	{

		StringBuffer sb = new StringBuffer();
		Iterator<String> it = tags.iterator();
		int x = tags.size();
		int i = 0;
		sb.append("[");
		while (it.hasNext())
		{
			if ((i>0)&&(i<x)) sb.append(", ");
		  	sb.append("\"");
		  	sb.append(it.next());
		  	sb.append("\"");
		  	i++;
		}
		sb.append("]");
		String tgs = sb.toString();
		return "{ type : \"Bookmark\",\n  label : \""+title+"\",\n  url : \""+url+"\",\n  description : \""+description+"\",\n  uid : \""+uid+"\",\n  creator : \""+creator+"\",\n  year : \""+year+"\",\n  tags : " + tgs+"\n},\n";
	}
}
